<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :xs="6" :sm="6" :md="6" :lg="6">
        <el-card class="domain-box">
          <h2>全部</h2>
          全部域名数量
          <div class="domain-num"><span>{{ domainStatistics.allNum }}</span>/个</div>
        </el-card>
      </el-col>
      <el-col :xs="6" :sm="6" :md="6" :lg="6">
        <el-card class="domain-box">
          <h2>待审批</h2>
          待审批域名数量
          <div class="domain-num"><span>{{ domainStatistics.unAuditStatusNum }}</span>/个</div>
        </el-card>
      </el-col>
      <el-col :xs="6" :sm="6" :md="6" :lg="6">
        <el-card class="domain-box">
          <h2>审批完成</h2>
          审批完成域名数量
          <div class="domain-num"><span>{{ domainStatistics.auditStatusCompleteNum }}</span>/个</div>
        </el-card>
      </el-col>
      <el-col :xs="6" :sm="6" :md="6" :lg="6">
        <el-card class="domain-box">
          <h2>审核驳回</h2>
          审核驳回域名数量
          <div class="domain-num"><span>{{ domainStatistics.rejectAuditStatusNum }}</span>/个</div>
        </el-card>
      </el-col>
    </el-row>
    <el-divider />
    <el-row :gutter="20">
      <el-col :xs="24" :sm="24" :md="12" :lg="12">
        <el-card class="update-log">
          <div ref="chart" class="chart"></div>
        </el-card>
      </el-col>
      <!-- <el-col :xs="24" :sm="24" :md="12" :lg="12">
        <el-card class="update-log">
        </el-card>
      </el-col> -->
    </el-row>
  </div>
</template>

<script>
import * as echarts from 'echarts'

import { getHomeDomainStatistics } from "@/api/system/domain";
export default {
  name: "Index",
  data() {
    return {
      // 版本号
      domainStatistics: {},
      dataArr: [],
      version: "3.8.7"
    };
  },
  mounted() {
    getHomeDomainStatistics().then(e => {
      this.domainStatistics = e.data.domainStatistics
      const dataArr = e.data.datas.data
      this.dataArr = dataArr
      const chart = echarts.init(this.$refs.chart, 'macarons')
      var option;
      option = {
        title: {
          text: '域名审核',
          // subtext: 'Fake Data',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: '累计数量',
            type: 'pie',
            radius: '50%',
            data: dataArr ,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };
      option && chart.setOption(option);
    })
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    }

  }
};
</script>

<style scoped lang="scss">
.chart {
  width: 500px;
  height: 500px;
}
.domain-box{
  background: #fff;
}
.domain-num {
  font-size: 22px;

  span {
    font-size: 56px;
  }
}

.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }

  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }

  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans",
  "Helvetica Neue",
  Helvetica,
  Arial,
  sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>
